function initComplete() {
    $.fn.zTree.init($("#treeDemo"), setting, zNodes), zTree_Menu = $.fn.zTree.getZTreeObj("treeDemo"), 
    /*showContent(),*/ $("#searchKey").keydown(function(a) {
        13 == a.keyCode && findNode();
    });
}

function showContent() {
    var b, c, a = jQuery.jCookie("leftTreeNodeId");
    0 == a || "false" == a ? (top.positionType = "simple", top.positionContent = "【" + uncompile(quiLanguage.treeAccordion.positionContent1) + "】") : (b = zTree_Menu.getNodeByParam("id", a), 
    zTree_Menu.selectNode(b), (0 === b.level || 1 === b.level) && (c = $("#" + b.tId + "_a"), 
    c.click()), b.url && (top.positionType = "simple", b.getParentNode() && (top.positionContent = "【" + uncompile(quiLanguage.treeAccordion.positionContent2) + b.getParentNode().name + ">>" + b.name + "】"), 
    top.frmright.location = b.url));
}

function beforeClick(a, b) {
    var c, d;
    0 === b.level ? ($("#" + a).find("a").each(function() {
        $(this).hasClass("curLevel0") && $(this).removeClass("curLevel0");
    }), c = $("#" + b.tId + "_a"), c.addClass("curLevel0"), b.open ? (zTree_Menu.expandNode(b, !1), 
    c = $("#" + b.tId + "_a"), c.removeClass("curLevel0"), c.removeClass("curSelectedNode")) : (zTree_Menu.expandAll(!1), 
    zTree_Menu.expandNode(b))) : 1 === b.level ? ($("#" + a).find("a").each(function() {
        $(this).hasClass("curLevel1") && $(this).removeClass("curLevel1");
    }), c = $("#" + b.tId + "_a"), c.addClass("curLevel1"), b.open ? (zTree_Menu.expandNode(b, !1), 
    c = $("#" + b.tId + "_a"), c.removeClass("curLevel1"), c.removeClass("curSelectedNode")) : (zTree_Menu.expandNode(b), 
    d = $("#" + b.getParentNode().tId + "_a"), d.addClass("curLevel0"))) : zTree_Menu.expandNode(b);
}

function onClick(a, b, c) {
    if (0 === c.level && !c.open) {
        var d = $("#" + c.tId + "_a");
        d.removeClass("curSelectedNode");
    }
    null != c.url && (showProgressBar(), top.positionContent = c.getParentNode() ? "【" + uncompile(quiLanguage.treeAccordion.positionContent2) + c.getParentNode().name + ">>" + c.name + "】" : "【" + uncompile(quiLanguage.treeAccordion.positionContent2) + c.name + "】", 
    top.positionType = "simple"), jQuery.jCookie("leftTreeNodeId", c.id.toString()), 
    0 === c.level && (c.open || jQuery.jCookie("leftTreeNodeId", "false"));
}

function showAll() {
    zTree_Menu.expandAll(!0);
}

function hideAll() {
    zTree_Menu.expandAll(!1), jQuery.jCookie("leftTreeNodeId", "false");
}

function findNode() {
    var a = $.trim($("#searchKey").val());
    "" != a && getNodesByParamFuzzy("name", a);
}

function getNodesByParamFuzzy(a, b, c) {
    var e, d = zTree_Menu.getNodesByParamFuzzy(a, b, c);
    highlightNodes(zTree_Menu, zTree_Menu.highlightNodeList, !1), highlightNodes(zTree_Menu, d, !0), 
    zTree_Menu.highlightNodeList = d, null != d && d.length > 0 && (zTree_Menu.expandAll(!1), 
    e = d[0].getParentNode(), zTree_Menu.expandNode(e, !0), zTree_Menu.expandNode(d[0], !0));
}

function highlightNodes(a, b, c) {
    if (null != b) for (var d = 0, e = b.length; e > d; d++) b[d].highlight = c, a.updateNode(b[d]);
}

function getFontCss(a, b) {
    return b.highlight ? {
        color: "#A60000",
        "font-weight": "bold"
    } : {
        color: "#333",
        "font-weight": "normal"
    };
}

function homeHandler() {
    zTree_Menu.expandAll(!1), top.positionType = "none", jQuery.jCookie("leftTreeNodeId", "false");
}

var zTree_Menu = null, setting = {
    view: {
        fontCss: getFontCss,
        showLine: !1,
        selectedMulti: !1,
        dblClickExpand: !1
    },
    callback: {
        beforeClick: beforeClick,
        onClick: onClick
    }
};